package com.shutong.edu.invoke.retry.processor;

import com.shutong.edu.invoke.retry.model.RetryInfo;

import java.lang.reflect.Method;

/**
 *
 * @ClassName: JdkProxyRetryProcessor.java
 * @author: Naughty Guo
 * @date: Jun 2, 2016
 */
public class JdkProxyRetryProcessor extends AbstractRetryProcessor {

    @Override
    protected Object doInvoke(RetryInfo retryInfo) throws Throwable {
        Method method = retryInfo.getTargetMethod();
        Object targetObject = retryInfo.getTargetOriginalObject();
        return method.invoke(targetObject, retryInfo.getArguments());
    }
}
